package com.per.mybootall.email.controller;

import com.per.mybootall.common.ServerResponse;
import com.per.mybootall.email.service.EmailInter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Resource
    private EmailInter emailInter;

    /**
     * 发送邮件【单纯的邮件】
     * */
    @RequestMapping("/sendEmail")
    public ServerResponse sendEmail(@RequestParam(value = "sendEmail")String sendEmail){
        emailInter.sendSimpleMail(sendEmail);
        return ServerResponse.creatBySuccessMessage("send success");
    }

    /**
     * 发送邮件的同时携带附件发送
     * */
    @RequestMapping("/sendEmailAndFile")
    public ServerResponse sendEmailAndFile(@RequestParam(value = "sendEmail")String sendEmail){
        emailInter.sendMail(sendEmail);
        return ServerResponse.creatBySuccessMessage("send success");
    }

}
